package itheima.com.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;

public class MyStream {
    public static void main(String[] args) {
//        method1();
        method2();
//        method3();
//        Stream.of(1,2,3,4,5,6,5,4).forEach(s-> System.out.println(s));
    }

    private static void method3() {
        int[] arr ={1,2,3,4,5};
        Arrays.stream(arr).forEach(s-> System.out.println(s));
    }

    private static void method2() {
        HashMap<String,Integer> hm = new HashMap<>();
        hm.put("zhaoyi",23);
        hm.put("xionger",21);
        hm.put("yinsan",24);
        hm.put("zhousi",22);
        hm.put("heiwu",25);
        hm.put("liuliu",28);

        hm.keySet().stream().forEach(s -> System.out.println(s));

        hm.entrySet().stream().forEach(ss -> System.out.println(ss));
    }

    private static void method1() {
        ArrayList<String> list =new ArrayList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");

        list.stream().forEach(s -> System.out.println(s));
    }

}
